<?php
/**
 * 
 * @author Duan
 *
 */
class PaymentPrime extends PaymentData {

	public $primeId;
	public $primePrice;
	public $primeTitle;
	public $primeYear;
	
	public function __construct(){
		$this->setName('prime');
	}
	
	public function getPrimeInfo($primeId){
		$primeInfo = Products::model()->findByPk($primeId);
		if(empty($primeInfo) == false){
			$this->primeId 		= $primeInfo->id;
			$this->primePrice 	= $primeInfo->value_price;
			$this->primeTitle 	= $primeInfo->title;
			$this->primeYear 	= $primeInfo->bids;
		}
		return $this;
	}
	
	public function vaild(){
		if (empty($this->primeId)){
			$this->setErrorMessage('primeId','primeId NO');
		}
		return $this->vaild;
	}
	
	public function toArray(){
		return array(
			'primeId' 		=> $this->primeId,
			'primePrice'	=> $this->primePrice,
			'primeTitle' 	=> $this->primeTitle,
			'primeYear'		=> $this->primeYear,
		);
	}
}
